package vip.xiaonuo.biz.modular.third.remote;


import cn.hutool.json.JSONUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

@Service
@Slf4j
public class TestClient {

    @Resource
    private RestTemplate restTemplate;

    public String getWeather(String city) {
        String url = "http://apis.juhe.cn/simpleWeather/query?city=" + city + "&key=f1a567b48420c1d17412d9491953e608 ";

        String forObject = restTemplate.getForObject(url, String.class);
        log.info("返回结果是：{}", JSONUtil.toJsonStr(forObject));
        return JSONUtil.toJsonStr(forObject);
    }


}
